package com.daiqee.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.daiqee.controller.support.CommonsController;
import com.daiqee.enums.RequestType;
import com.daiqee.pojo.ProductClass;
import com.daiqee.service.impl.ProductClassService;
import com.daiqee.vo.LayuiVO;

/**
 * 货物分类
 * 
 * <br/>
 * @since JDK 1.8
 * @version  V2.1
 * @author RichardTang 
 * @date: 2018年5月15日
 * @package com.daiqee.handler
 * @copyright:Copyright (c) 2018, 1245811923@qq.com All Rights Reserved.
 */

@Controller
@RequestMapping("repository/product-class")
public class ProductClassController extends CommonsController<ProductClass>{

	@Autowired
	private ProductClassService productClassService;
	
	@RequestMapping(value = "/layui",method = RequestMethod.GET)
	public Object queryProductClassByLayui() {
		
		LayuiVO<ProductClass> layVo = new LayuiVO<ProductClass>();
		List<ProductClass> result = productClassService.selectList(null);
		if(result != null && !(result.isEmpty())) {
			layVo.setMsg("加载货物分类成功");
			layVo.setCode(0);
			layVo.setCount(result.size());
			layVo.setData(result);
		}
		return restfulResponse.response(layVo,RequestType.GET);
	}
}
